//引入全部全局组件
import SvgIcon from '@/components/SvgIcon/index.vue';
import Category from '@/components/Category/index.vue';
//引入全部图标组件
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
// console.log(ElementPlusIconsVue);

//全局对象
const allGloablComponent: any = { SvgIcon, Category };
export default {
  //必须叫install方法
  install(app: any) {
    //注册全部组件
    Object.keys(allGloablComponent).forEach((key) => {
      console.log('注册全局组件', key, allGloablComponent[key]);

      app.component(key, allGloablComponent[key]);
    });

    //将element图标注册为全局组件
    for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
      app.component(key, component);
    }
  },
};
